import request from '@/utils/request'
import { postRequest as postRequest01 } from './indexLocal'

// export async function queryProse(url,data): Promise<any> {
//   return request('/project/prose/'+url,{
//     method: 'POST',
//     data: data
//   })
// }

// export async function mockProse(url,data): Promise<any> {
//   console.log(url)
//   return request('/project/mock/',{
//     method: 'POST',
//     data: data
//   })
// }

export async function postRequest(url,data): Promise<any> {
  if(process.env.VUE_APP_NO_API){
    return postRequest01(url,data)
  }else{
    return request(url,{
      method: 'POST',
      data: data,
    })
  }
}
export async function postRequestParams(url,params): Promise<any> {
  if(process.env.VUE_APP_NO_API){
    return postRequest01(url,params)
  }else{
    return request(url,{
      method: 'POST',
      // data: params,
      params: params
    })
  }
}

export async function getRequest(url,params): Promise<any> {
    return request(url,{
      method: 'GET',
      params: params
    })
}
// export async function getRequest(url): Promise<any> {
//   return request(url)
// }

// 播放成功提示音
export function scanSuccess() {
  const audio = new Audio('/success.mp3')
  audio.play()
}
// 播放失败提示音
export function scanFail() {
  const audio = new Audio('/worn.mp3')
  audio.play()
}
